<?php


require "database.php";

$__user___=file_get_contents("user.json");
$__user___=json_decode($__user___,1);
$username=$_POST["username"];
$password=$_POST["password"];
for ($i = 0; $i < count($__user___); $i++) {
    if($__user___[$i]["username"]==$username && $__user___[$i]["password"]==$password){
        return json([
            "code"=>200,
            "msg"=>"登录成功",
            "data"=>[
                "username"=>$username 
            ]
        ]);
    }else{
        return json([
            "code"=>404,
            "msg"=>"登录失败"    
        ]);
    }
}












